#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
vector<int> G[MAXN]; int f[MAXN], g[MAXN]; int A, B;
int dep[MAXN], fa[MAXN];
void dfs0(int u, int f) {
	dep[u] = u == f ? 0 : dep[f] + 1; fa[u] = f; for (int v : G[u]) if (v != f) dfs0(v, u);
}
int S, T; int times; int dfn[MAXN], low[MAXN], ord[MAXN], head[MAXN];
vector<int> vid;
void dfs2(int u, int f, int t = 0) {
	if (dep[u] - dep[S] > A + B) return;
	if (dep[u] - dep[S] > A - B) vid.push_back(u);
	if (dep[u] - dep[S] <= A) dfn[u] = times + 1;
	if (dep[u] - dep[S] == A) ord[++times] = t = u;
	if (dep[u] - dep[S] >= A) head[u] = t;
	for (int v : G[u]) if (v != f && v != T) dfs2(v, u, t);
	if (dep[u] - dep[S] <= A) low[u] = times;
}
int dfs3(int u, int f) {
	if (dep[u] - dep[S] > B) return 0x3f3f3f3f;
	int ans = u; for (int v : G[u]) if (v != f && v != T) ans = min(ans, dfs3(v, u));
	return ans;
}
int bfn[MAXN];
struct pq {
	priority_queue<int, vector<int>, greater<int>> p, q;
	void push(int x) {p.push(x);}
	void erase(int x) {q.push(x);}
	bool empty() {
		while (p.empty() == 0 && q.empty() == 0 && p.top() == q.top()) p.pop(), q.pop();
		return p.empty();
	}
	int top() {
		while (p.empty() == 0 && q.empty() == 0 && p.top() == q.top()) p.pop(), q.pop();
		return p.top();
	}
};
int main() {
	freopen("nim.in", "r", stdin); freopen("nim.out", "w", stdout);
	int n, r; scanf("%d %d", &n, &r); scanf("%d %d", &A, &B);
	if (A <= B) return puts("1"), 0;
	for (int i = 1; i < n; i++) {
		int u, v; scanf("%d %d", &u, &v); G[u].push_back(v); G[v].push_back(u);
	}
	dfs0(r, r); for (int i = 1; i <= n; i++) bfn[i] = i;
	sort(bfn + 1, bfn + 1 + n, [&](int x, int y) {return dep[x] > dep[y];});
	for (int _ = 1; _ <= n; _++) {
		// calc f
		static vector<pair<int, int>> wt[MAXN];
		static vector<int> era[MAXN];
		int u = S = bfn[_]; T = 0; times = 0; vid.clear(); dfs2(u, fa[u]);
		if (times == 0) f[u] = dfs3(u, fa[u]);
		else {
			for (int i = 1; i <= times; i++) wt[i].clear(), era[i].clear();
			for (int V : vid) {
				if (dep[V] - dep[S] <= A && dep[V] - dep[S] > A - B) {
					if (dfn[V] <= low[V]) {
						wt[dfn[V]].push_back({low[V], g[V]});
					}
				}
				if (dep[V] - dep[S] >= A && dep[V] - dep[S] <= A + B) {
					wt[dfn[head[V]]].push_back({low[head[V]], f[V]});
				}
			}
			pq hihi; hihi.push(0); era[1].push_back(0);
			for (int i = 1; i <= times; i++) {
				int cur = hihi.top();
				for (auto &w : wt[i]) {
					hihi.push(max(cur, w.second)); if (w.first < times) era[w.first + 1].push_back(max(cur, w.second));
				}
				for (int w : era[i]) hihi.erase(w);
			}
			f[u] = hihi.top();
		}
		// calc g
		for (int v : G[u]) if (v != fa[u]) {
			T = v; times = 0; vid.clear(); dfs2(u, fa[u]);
			if (times == 0) g[v] = dfs3(u, fa[u]);
			else {
				for (int i = 1; i <= times; i++) wt[i].clear(), era[i].clear();
				for (int V : vid) {
					if (dep[V] - dep[S] <= A && dep[V] - dep[S] > A - B) {
						if (dfn[V] <= low[V]) wt[dfn[V]].push_back({low[V], g[V]});
					}
					if (dep[V] - dep[S] >= A && dep[V] - dep[S] <= A + B) {
						wt[dfn[head[V]]].push_back({low[head[V]], f[V]});
					}
				}
				pq hihi; hihi.push(0); era[1].push_back(0);
				for (int i = 1; i <= times; i++) {
					int cur = hihi.top();
					for (auto &w : wt[i]) {
						hihi.push(max(cur, w.second)); if (w.first < times) era[w.first + 1].push_back(max(cur, w.second));
					}
					for (int w : era[i]) hihi.erase(w);
				}
				g[v] = hihi.top();
			}
		}
	}
	printf("%d\n", f[r]);
}